using StackExchange.Redis;

namespace imitateMacQQ.WebApi.Repository.Redis;

public static class RedisProtect
{
    public static void Redis_Initialization(IDatabase redisHelper)
    {
        _redis = redisHelper;
    }

    private static IDatabase? _redis;

    public static bool Set(string key, string value)
    {
        return _redis != null && _redis.StringSet(key, value);
    }

    public static string Get(string key)
    {
        return _redis == null ? "" : _redis.StringGet(key).ToString();
    }

    public static bool Del(string key)
    {
        return _redis != null && _redis.KeyDelete(key);
    }
}